--  Copyright (c) 2010 - 2018, Nordic Semiconductor ASA
--
--  All rights reserved.
--
--  Redistribution and use in source and binary forms, with or without modification,
--  are permitted provided that the following conditions are met:
--
--  1. Redistributions of source code must retain the above copyright notice, this
--  list of conditions and the following disclaimer.
--
--  2. Redistributions in binary form, except as embedded into a Nordic
--  Semiconductor ASA integrated circuit in a product or a software update for
--  such product, must reproduce the above copyright notice, this list of
--  conditions and the following disclaimer in the documentation and/or other
--  materials provided with the distribution.
--
--  3. Neither the name of Nordic Semiconductor ASA nor the names of its
--  contributors may be used to endorse or promote products derived from this
--  software without specific prior written permission.
--
--  4. This software, with or without modification, must only be used with a
--  Nordic Semiconductor ASA integrated circuit.
--
--  5. Any software provided in binary form under this license must not be reverse
--  engineered, decompiled, modified and/or disassembled.
--
--  THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
--  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--  OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
--  DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
--  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
--  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
--  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
--  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
--  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
--  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--

--  This spec has been automatically generated from nrf52.svd

pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);

with HAL;
with System;

package NRF_SVD.EGU is
   pragma Preelaborate;

   ---------------
   -- Registers --
   ---------------

   --  Description collection[0]: Trigger 0 for triggering the corresponding TRIGGERED[0] event

   --  Description collection[0]: Trigger 0 for triggering the corresponding
   --  TRIGGERED[0] event
   type TASKS_TRIGGER_Registers is array (0 .. 15) of HAL.UInt32;

   --  Description collection[0]: Event number 0 generated by triggering the corresponding TRIGGER[0] task

   --  Description collection[0]: Event number 0 generated by triggering the
   --  corresponding TRIGGER[0] task
   type EVENTS_TRIGGERED_Registers is array (0 .. 15) of HAL.UInt32;

   --  Enable or disable interrupt for TRIGGERED[0] event
   type INTEN_TRIGGERED0_Field is
     (--  Disable
      Disabled,
      --  Enable
      Enabled)
     with Size => 1;
   for INTEN_TRIGGERED0_Field use
     (Disabled => 0,
      Enabled => 1);

   --  INTEN_TRIGGERED array
   type INTEN_TRIGGERED_Field_Array is array (0 .. 15)
     of INTEN_TRIGGERED0_Field
     with Component_Size => 1, Size => 16;

   --  Type definition for INTEN_TRIGGERED
   type INTEN_TRIGGERED_Field
     (As_Array : Boolean := False)
   is record
      case As_Array is
         when False =>
            --  TRIGGERED as a value
            Val : HAL.UInt16;
         when True =>
            --  TRIGGERED as an array
            Arr : INTEN_TRIGGERED_Field_Array;
      end case;
   end record
     with Unchecked_Union, Size => 16;

   for INTEN_TRIGGERED_Field use record
      Val at 0 range 0 .. 15;
      Arr at 0 range 0 .. 15;
   end record;

   --  Enable or disable interrupt
   type INTEN_Register is record
      --  Enable or disable interrupt for TRIGGERED[0] event
      TRIGGERED      : INTEN_TRIGGERED_Field :=
                        (As_Array => False, Val => 16#0#);
      --  unspecified
      Reserved_16_31 : HAL.UInt16 := 16#0#;
   end record
     with Volatile_Full_Access, Object_Size => 32,
          Bit_Order => System.Low_Order_First;

   for INTEN_Register use record
      TRIGGERED      at 0 range 0 .. 15;
      Reserved_16_31 at 0 range 16 .. 31;
   end record;

   --  Write '1' to Enable interrupt for TRIGGERED[0] event
   type INTENSET_TRIGGERED0_Field is
     (--  Read: Disabled
      Disabled,
      --  Read: Enabled
      Enabled)
     with Size => 1;
   for INTENSET_TRIGGERED0_Field use
     (Disabled => 0,
      Enabled => 1);

   --  Write '1' to Enable interrupt for TRIGGERED[0] event
   type INTENSET_TRIGGERED0_Field_1 is
     (--  Reset value for the field
      Intenset_Triggered0_Field_Reset,
      --  Enable
      Set)
     with Size => 1;
   for INTENSET_TRIGGERED0_Field_1 use
     (Intenset_Triggered0_Field_Reset => 0,
      Set => 1);

   --  INTENSET_TRIGGERED array
   type INTENSET_TRIGGERED_Field_Array is array (0 .. 15)
     of INTENSET_TRIGGERED0_Field_1
     with Component_Size => 1, Size => 16;

   --  Type definition for INTENSET_TRIGGERED
   type INTENSET_TRIGGERED_Field
     (As_Array : Boolean := False)
   is record
      case As_Array is
         when False =>
            --  TRIGGERED as a value
            Val : HAL.UInt16;
         when True =>
            --  TRIGGERED as an array
            Arr : INTENSET_TRIGGERED_Field_Array;
      end case;
   end record
     with Unchecked_Union, Size => 16;

   for INTENSET_TRIGGERED_Field use record
      Val at 0 range 0 .. 15;
      Arr at 0 range 0 .. 15;
   end record;

   --  Enable interrupt
   type INTENSET_Register is record
      --  Write '1' to Enable interrupt for TRIGGERED[0] event
      TRIGGERED      : INTENSET_TRIGGERED_Field :=
                        (As_Array => False, Val => 16#0#);
      --  unspecified
      Reserved_16_31 : HAL.UInt16 := 16#0#;
   end record
     with Volatile_Full_Access, Object_Size => 32,
          Bit_Order => System.Low_Order_First;

   for INTENSET_Register use record
      TRIGGERED      at 0 range 0 .. 15;
      Reserved_16_31 at 0 range 16 .. 31;
   end record;

   --  Write '1' to Disable interrupt for TRIGGERED[0] event
   type INTENCLR_TRIGGERED0_Field is
     (--  Read: Disabled
      Disabled,
      --  Read: Enabled
      Enabled)
     with Size => 1;
   for INTENCLR_TRIGGERED0_Field use
     (Disabled => 0,
      Enabled => 1);

   --  Write '1' to Disable interrupt for TRIGGERED[0] event
   type INTENCLR_TRIGGERED0_Field_1 is
     (--  Reset value for the field
      Intenclr_Triggered0_Field_Reset,
      --  Disable
      Clear)
     with Size => 1;
   for INTENCLR_TRIGGERED0_Field_1 use
     (Intenclr_Triggered0_Field_Reset => 0,
      Clear => 1);

   --  INTENCLR_TRIGGERED array
   type INTENCLR_TRIGGERED_Field_Array is array (0 .. 15)
     of INTENCLR_TRIGGERED0_Field_1
     with Component_Size => 1, Size => 16;

   --  Type definition for INTENCLR_TRIGGERED
   type INTENCLR_TRIGGERED_Field
     (As_Array : Boolean := False)
   is record
      case As_Array is
         when False =>
            --  TRIGGERED as a value
            Val : HAL.UInt16;
         when True =>
            --  TRIGGERED as an array
            Arr : INTENCLR_TRIGGERED_Field_Array;
      end case;
   end record
     with Unchecked_Union, Size => 16;

   for INTENCLR_TRIGGERED_Field use record
      Val at 0 range 0 .. 15;
      Arr at 0 range 0 .. 15;
   end record;

   --  Disable interrupt
   type INTENCLR_Register is record
      --  Write '1' to Disable interrupt for TRIGGERED[0] event
      TRIGGERED      : INTENCLR_TRIGGERED_Field :=
                        (As_Array => False, Val => 16#0#);
      --  unspecified
      Reserved_16_31 : HAL.UInt16 := 16#0#;
   end record
     with Volatile_Full_Access, Object_Size => 32,
          Bit_Order => System.Low_Order_First;

   for INTENCLR_Register use record
      TRIGGERED      at 0 range 0 .. 15;
      Reserved_16_31 at 0 range 16 .. 31;
   end record;

   -----------------
   -- Peripherals --
   -----------------

   --  Event Generator Unit 0
   type EGU_Peripheral is record
      --  Description collection[0]: Trigger 0 for triggering the corresponding
      --  TRIGGERED[0] event
      TASKS_TRIGGER    : aliased TASKS_TRIGGER_Registers;
      --  Description collection[0]: Event number 0 generated by triggering the
      --  corresponding TRIGGER[0] task
      EVENTS_TRIGGERED : aliased EVENTS_TRIGGERED_Registers;
      --  Enable or disable interrupt
      INTEN            : aliased INTEN_Register;
      --  Enable interrupt
      INTENSET         : aliased INTENSET_Register;
      --  Disable interrupt
      INTENCLR         : aliased INTENCLR_Register;
   end record
     with Volatile;

   for EGU_Peripheral use record
      TASKS_TRIGGER    at 16#0# range 0 .. 511;
      EVENTS_TRIGGERED at 16#100# range 0 .. 511;
      INTEN            at 16#300# range 0 .. 31;
      INTENSET         at 16#304# range 0 .. 31;
      INTENCLR         at 16#308# range 0 .. 31;
   end record;

   --  Event Generator Unit 0
   EGU0_Periph : aliased EGU_Peripheral
     with Import, Address => EGU0_Base;

   --  Event Generator Unit 1
   EGU1_Periph : aliased EGU_Peripheral
     with Import, Address => EGU1_Base;

   --  Event Generator Unit 2
   EGU2_Periph : aliased EGU_Peripheral
     with Import, Address => EGU2_Base;

   --  Event Generator Unit 3
   EGU3_Periph : aliased EGU_Peripheral
     with Import, Address => EGU3_Base;

   --  Event Generator Unit 4
   EGU4_Periph : aliased EGU_Peripheral
     with Import, Address => EGU4_Base;

   --  Event Generator Unit 5
   EGU5_Periph : aliased EGU_Peripheral
     with Import, Address => EGU5_Base;

end NRF_SVD.EGU;
